package com.aos.iot.socket.common.client;

import com.aos.iot.socket.common.handler.SocketClient;
import com.aos.iot.socket.common.message.Message;
import io.netty.channel.Channel;

import java.net.SocketAddress;

public interface IClientBox<M extends Message, C extends SocketClient<M>> {

    void add(String clientId, C client, SocketAddress socketAddress);

    C get(String clientId);

    C get(Channel channel);

    SocketAddress getRemoteAddress(String clientId);

    SocketAddress getRemoteAddress(Channel channel);

    void updateRemoteAddress(C client, SocketAddress socketAddress);

    void remove(String clientId);

    void remove(Channel channel);

    boolean has(String clientId);

    boolean has(Channel channel);

    int size();

    String protocolName();

    default IClientBox<M, C> client() {
        return this;
    }
}
